//package com.hk.yajin.utills.url;
//
//import android.text.TextUtils;
//
//
//import org.xutils.common.util.LogUtil;
//
//import java.util.Map;
//
//
///**
// * url工具类--拼接
// *
// * @author wl
// */
//public class URLUtils {
//
//    public enum UrlType {
//        FUNCTION_NEWS_TYPE_LIST,
//        FUNCTION_NEWS_LIST,
//        FUNCTION_NEWS_DETAIL,
//        FUNCTION_INDEX_ALLDATA,
//        FUNCTION_DHXZ_BOOK_DETAIL,
//        FUNCTION_DHXZ_DOWNLOAD_BOOK,
//        FUNCTION_DHXZ_CHAPTER_LIST,
//        FUNCTION_DHXZ_CHAPTER_DETAIL,
//        FUNCTION_CHECK_ACCOUNT,
//        FUNCTION_APP_LOGIN,
//        FUNCTION_APP_LOGIN_REGISTER,
//        FUNCTION_APP_LOGIN_WEIXIN,
//        FUNCTION_MEMBER_INFO_SUBMIT,
//        FUNCTION_MEMBER_INFOMATION,
//        FUNCTION_DHXZ_BOOK_TYPE_LIST,
//        FUNCTION_DHXZ_LOAD_BOOK_LIST,
//        FUNCTION_INDEX_LOAD_COLUMN,
//        FUNCTION_SETTING_COLUMN,
//        FUNCTION_LOAD_INDEX_DATA,
//        FUNCTION_LOAD_SCIENCE_DATA,
//        FUNCTION_LOAD_SCIENCE_TYPES,
//        FUNCTION_LOAD_ZHUYOU_DATA,
//        FUNCTION_LOAD_ZHUYOU_TYPES,
//        FUNCTION_LOAD_WUGONG_DATA,
//        FUNCTION_LOAD_WUGONG_TYPES,
//        FUNCTION_LOAD_DAOYI_DATA,
//        FUNCTION_LOAD_DAOYI_TYPES,
//        FUNCTION_LOAD_YANGSHENG_DATA,
//        FUNCTION_LOAD_YANGSHENG_LIST_DATA,
//        FUNCTION_LOAD_TAIJI_DATA,
//        FUNCTION_LOAD_TAIJI_LIST_DATA,
//        FUNCTION_LOAD_TAIJI_TYPES,
//        FUNCTION_LOAD_FENGSHUI_DATA,
//        FUNCTION_LOAD_FENGSHUI_LIST_DATA,
//        FUNCTION_LOAD_CULTURE_DATA,
//        FUNCTION_LOAD_CULTURE_DETAIL,
//        FUNCTION_LOAD_BAIKE_DATA,
//        FUNCTION_LOAD_BAIKE_LIST_DATA,
//        FUNCTION_LOAD_BAIKE_TYPES,
//        FUNCTION_LOAD_YANGSHENG_DETAIL,
//        FUNCTION_LOAD_ZHUYOU_DETAIL,
//        FUNCTION_LOAD_TAIJI_DETAIL,
//        FUNCTION_LOAD_WUGONG_DETAIL,
//        FUNCTION_LOAD_SCIENCE_DETAIL,
//        FUNCTION_LOAD_FENGSHUI_DETAIL,
//        FUNCTION_LOAD_BAIKE_DETAIL,
//        FUNCTION_LOAD_DAOYI_DETAIL,
//        FUNCTION_LOAD_QIUDAO_FIND_LIST,
//        FUNCTION_LOAD_QIUDAO_MYFOUCS_LIST,
//        FUNCTION_LOAD_QIUDAO_MYQUESTION_LIST,
//        FUNCTION_LOAD_QIUDAO_MYQUESTION_DEL,
//        FUNCTION_LOAD_QIUDAO_MYANSWER_DEL,
//        FUNCTION_LOAD_QIUDAO_MYANSWER_LIST,
//        FUNCTION_LOAD_QIUDAO_FOCUS_QUESTION,
//
//        FUNCTION_LOAD_QIUDAO_PUBLIC_QUESTION,
//        FUNCTION_LOAD_QIUDAO_PUBLIC_ANWSER,
//        FUNCTION_LOAD_QIUDAO_TOPICS,
//        FUNCTION_LOAD_QIUDAO_QUESTION_DETAIL,
//        FUNCTION_LOAD_TAIJI_VIDEO_LIST,
//        FUNCTION_LOAD_BAIKE_VIDEO_LIST,
//        FUNCTION_LOAD_TAIJI_MUSIC_LIST,
//        FUNCTION_LOAD_BAIKE_MUSIC_LIST,
//        FUNCTION_LOAD_SEARCH_LIST,
//        FUNCTION_APP_CHECK_UPDATA,
//        FUNCTION_APP_COLLECTION,
//        FUNCTION_APP_LOAD_COLLECTION_LIST
//    }
//
//    /**
//     * 获取接口url
//     *
//     * @param reqParam 接口中需要的参数
//     * @param urlType  指示是哪个接口接口
//     * @return
//     */
//    public static String getConnectUrl(Map<String, String> reqParam, UrlType urlType) {
//        String urlString = null;
//        switch (urlType) {
//
//            case FUNCTION_NEWS_TYPE_LIST:
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_NEWS_TYPE_LIST, reqParam);
//                break;
//            case FUNCTION_NEWS_LIST:
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_NEWS_LIST, reqParam);
//                break;
//            case FUNCTION_NEWS_DETAIL:
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_NEWS_DETAIL, reqParam);
//                break;
//            case FUNCTION_INDEX_ALLDATA:
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_INDEX_ALLDATA, reqParam);
//                break;
//            case FUNCTION_DHXZ_BOOK_DETAIL:
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_DHXZ_BOOK_DETAIL, reqParam);
//                break;
//            case FUNCTION_DHXZ_DOWNLOAD_BOOK:
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_DHXZ_DOWNLOAD_BOOK, reqParam);
//                break;
//
//            case FUNCTION_DHXZ_CHAPTER_LIST: // 拉取章节列表
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_DHXZ_CHAPTER_LIST, reqParam);
//                break;
//            case FUNCTION_DHXZ_CHAPTER_DETAIL: // 拉取章节详情
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_DHXZ_CHAPTER_DETAIL, reqParam);
//                break;
//            case FUNCTION_CHECK_ACCOUNT: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_CHECK_ACCOUNT, reqParam);
//                break;
//            case FUNCTION_APP_LOGIN: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_APP_LOGIN, reqParam);
//                break;
//            case FUNCTION_APP_LOGIN_REGISTER: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_APP_LOGIN_REGISTER, reqParam);
//                break;
//            case FUNCTION_APP_LOGIN_WEIXIN: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_APP_LOGIN_WEIXIN, reqParam);
//                break;
//
//            case FUNCTION_MEMBER_INFO_SUBMIT: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_MEMBER_INFO_SUBMIT, reqParam);
//                break;
//            case FUNCTION_MEMBER_INFOMATION: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_MEMBER_INFOMATION, reqParam);
//                break;
//
//            case FUNCTION_DHXZ_BOOK_TYPE_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_DHXZ_BOOK_TYPE_LIST, reqParam);
//                break;
//            case FUNCTION_DHXZ_LOAD_BOOK_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_DHXZ_LOAD_BOOK_LIST, reqParam);
//                break;
//            case FUNCTION_INDEX_LOAD_COLUMN: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_INDEX_LOAD_COLUMN, reqParam);
//                break;
//            case FUNCTION_SETTING_COLUMN: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_SETTING_COLUMN, reqParam);
//                break;
//            case FUNCTION_LOAD_INDEX_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_INDEX_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_SCIENCE_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_SCIENCE_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_SCIENCE_TYPES: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_SCIENCE_TYPES, reqParam);
//                break;
//            case FUNCTION_LOAD_ZHUYOU_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_ZHUYOU_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_WUGONG_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_WUGONG_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_DAOYI_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_DAOYI_DATA, reqParam);
//                break;
//
//
//            case FUNCTION_LOAD_ZHUYOU_TYPES: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_ZHUYOU_TYPES, reqParam);
//                break;
//
//            case FUNCTION_LOAD_WUGONG_TYPES: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_WUGONG_TYPES, reqParam);
//                break;
//            case FUNCTION_LOAD_DAOYI_TYPES: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_DAOYI_TYPES, reqParam);
//                break;
//
//            case FUNCTION_LOAD_YANGSHENG_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_YANGSHENG_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_YANGSHENG_LIST_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_YANGSHENG_LIST_DATA, reqParam);
//                break;
//
//            case FUNCTION_LOAD_TAIJI_LIST_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_TAIJI_LIST_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_TAIJI_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_TAIJI_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_TAIJI_TYPES: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_TAIJI_TYPES, reqParam);
//                break;
//
//            case FUNCTION_LOAD_FENGSHUI_LIST_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_FENGSHUI_LIST_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_FENGSHUI_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_FENGSHUI_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_CULTURE_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_CULTURE_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_CULTURE_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_CULTURE_DETAIL, reqParam);
//                break;
//
//            case FUNCTION_LOAD_BAIKE_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_BAIKE_DATA, reqParam);
//                break;
//            case FUNCTION_LOAD_BAIKE_LIST_DATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_BAIKE_LIST_DATA, reqParam);
//                break;
//
//            case FUNCTION_LOAD_BAIKE_TYPES: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_BAIKE_TYPES, reqParam);
//                break;
//            case FUNCTION_LOAD_YANGSHENG_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_YANGSHENG_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_ZHUYOU_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_ZHUYOU_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_TAIJI_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_TAIJI_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_WUGONG_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_WUGONG_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_SCIENCE_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_SCIENCE_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_FENGSHUI_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_FENGSHUI_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_BAIKE_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_BAIKE_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_DAOYI_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_DAOYI_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_QIUDAO_FIND_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_FIND_LIST, reqParam);
//                break;
//            case FUNCTION_LOAD_QIUDAO_MYFOUCS_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_MYFOUCS_LIST, reqParam);
//                break;
//            case FUNCTION_LOAD_QIUDAO_MYQUESTION_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_MYQUESTION_LIST, reqParam);
//                break;
//            case FUNCTION_LOAD_QIUDAO_MYQUESTION_DEL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_MYQUESTION_DEL, reqParam);
//                break;
//
//            case FUNCTION_LOAD_QIUDAO_MYANSWER_DEL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_MYANSWER_DEL, reqParam);
//                break;
//
//            case FUNCTION_LOAD_QIUDAO_MYANSWER_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_MYANSWER_LIST, reqParam);
//                break;
//            case FUNCTION_LOAD_QIUDAO_FOCUS_QUESTION: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_FOCUS_QUESTION, reqParam);
//                break;
//
//            case FUNCTION_LOAD_QIUDAO_PUBLIC_QUESTION: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_PUBLIC_QUESTION, reqParam);
//                break;
//            case FUNCTION_LOAD_QIUDAO_PUBLIC_ANWSER: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_PUBLIC_ANWSER, reqParam);
//                break;
//            case FUNCTION_LOAD_QIUDAO_TOPICS: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_TOPICS, reqParam);
//                break;
//            case FUNCTION_LOAD_QIUDAO_QUESTION_DETAIL: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_QIUDAO_QUESTION_DETAIL, reqParam);
//                break;
//            case FUNCTION_LOAD_TAIJI_VIDEO_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_TAIJI_VIDEO_LIST, reqParam);
//                break;
//            case FUNCTION_LOAD_TAIJI_MUSIC_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_TAIJI_MUSIC_LIST, reqParam);
//                break;
//
//            case FUNCTION_LOAD_BAIKE_VIDEO_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_BAIKE_VIDEO_LIST, reqParam);
//                break;
//
//
//            case FUNCTION_LOAD_BAIKE_MUSIC_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_BAIKE_MUSIC_LIST, reqParam);
//                break;
//
//            case FUNCTION_LOAD_SEARCH_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_LOAD_SEARCH_LIST, reqParam);
//                break;
//            case FUNCTION_APP_CHECK_UPDATA: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_APP_CHECK_UPDATA, reqParam);
//                break;
//            case FUNCTION_APP_COLLECTION: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_APP_COLLECTION, reqParam);
//                break;
//            case FUNCTION_APP_LOAD_COLLECTION_LIST: //
//                urlString = concatRestUriTemplate(UrlConstants.FUNCTION_APP_LOAD_COLLECTION_LIST, reqParam);
//                break;
//
//            default:
//                break;
//        }
//        LogUtil.i(urlString + "");
//        return urlString;
//
//    }
//
//    /**
//     * 获取图片加载地址
//     *
//     * @param requestUrl
//     * @param linkMapperAddress
//     * @return
//     */
//    public static String getDownUrl(String requestUrl, String linkMapperAddress) {
//        String urlString = concatRequestDomain(requestUrl, linkMapperAddress);
//        return urlString;
//
//    }
//
//    /**
//     * 获取头像地址
//     *
//     * @param headUri
//     * @param linkMapperAddress
//     * @return
//     */
//    // public static String getHeadUrl(String headUri, String linkMapperAddress)
//    // {
//    // String urlString;
//    // if (DefaultHeadUtils.isNativeUri(headUri)) {
//    // urlString = DefaultHeadUtils.getNativeHeadUri(headUri);
//    // } else {
//    // urlString = concatRequestDomain(headUri, linkMapperAddress);
//    // }
//    // return urlString;
//    //
//    // }
//
//    /**
//     * 将rest请求的路径上的参数替换掉,如/api/v1/app/{uid}/shares?pageNum={pageNum}
//     *
//     * @param restUriTemplate 请求的RestPath模板uri
//     * @param restPathParam
//     * @return
//     */
//    private static String concatRestUriTemplate(String restUriTemplate, Map<String, String> restPathParam) throws IllegalArgumentException {
//        if (TextUtils.isEmpty(restUriTemplate)) {
//            throw new IllegalArgumentException("restUriTemplate 不能为空！");
//        }
//
//        String restUri = restUriTemplate;
//        try {
//            for (Map.Entry<String, String> param : restPathParam.entrySet()) {
//                restUri = restUri.replace(param.getKey(), param.getValue());
//            }
//        } catch (Exception e) {
//            // TODO: handle exception
//            LogUtil.e("========================" + e.getClass() + e.getLocalizedMessage() + "Url构建出错，缺少参数！", e);
//            if (TextUtils.isEmpty(restPathParam.get("{address}"))) {
//                // 缺少域名
//                LogUtil.e("Url构建出错，缺少域名！");
//                // MyApplication myApplication = (MyApplication) MyApplication
//                // .getInstance();
//                // myApplication.getLoginCache();
//            }
//        }
//
//        restUri = restUri.replace(" ", "%20");
//        return restUri;
//    }
//
//    /**
//     * 此方法先判断 如果要发起的请求url已经带有域名了，就直接返回请求url， 否则再根据linkMapper的域名地址拼接
//     *
//     * @param requestUrl        要发起请求的url
//     * @param linkMapperAddress 从linkMapper获取到的域名前缀链接
//     * @return
//     * @throws IllegalArgumentException 参数不合法时抛出
//     */
//    public static String concatRequestDomain(String requestUrl, String linkMapperAddress) throws IllegalArgumentException {
//
//        if (TextUtils.isEmpty(requestUrl)) {
//            LogUtil.e("requestUrl 不能为空！");
//        }
//
//        // 如果是http://或https://开头的，就不用再组装
//        if (requestUrl.startsWith("http://") || requestUrl.startsWith("https://")) {
//            return requestUrl;
//        }
//
//        if (!linkMapperAddress.startsWith("http://") && !linkMapperAddress.startsWith("https://")) {
//            LogUtil.e("linkMapperAddress 必须以http://或https://开头");
//        }
//
//        if (linkMapperAddress.endsWith("/")) {
//            if (requestUrl.startsWith("/")) {
//                return linkMapperAddress + requestUrl.substring(1);// 忽略掉重复的
//                // / 号
//            } else {
//                return linkMapperAddress + requestUrl;
//            }
//        } else {
//            if (requestUrl.startsWith("/")) {
//                return linkMapperAddress + requestUrl;
//            } else {
//                return linkMapperAddress + '/' + requestUrl;// 忽略掉重复的 / 号
//            }
//        }
//    }
//
//
//}
